bin=httpserver
src=main.cc
cc=g++
cgi=cgi_bin,shell_cgi.sh,python_cgi.py
FLAGS=-std=c++11 -lpthread #-DDEBUG1
pwd=$(shell pwd)

.PHONY:all
all:CGI $(bin) 

$(bin):$(src)
	$(cc) -o $@ $^ $(FLAGS)

CGI:
		cd $(pwd)/Cgi;\
		make;\
		cd -;

.PHONY:Output
output:
	mkdir -p Output
	mkdir -p Output/Web
	cp -r $(pwd)/Cgi/{$(cgi)} $(pwd)/Web 
	cp -r $(pwd)/Web $(pwd)/Output
	cp -r $(bin) $(pwd)/Output
.PHONY:clean
clean:
	rm -rf *.o $(bin) Output;\
	cd $(pwd)/Cgi;\
	make clean;\
	cd -;


